<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div class="modal-dialog ms-modal-dialog" id="reverse-order-edit-aviatino-user-info-dialog">
  <div class="modal-content">

    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
              class="sr-only">Close</span></button>
      <h4 class="modal-title">修改乘机人</h4>
    </div>

    <form class="form-horizontal ms-form" role="form" method="POST"
          action="${ctx.host}/reverse-orders/${orderId}/edit-aviation-user-info" data-validate="true" >

      <input type="hidden" name="_method" value="PATCH"/>

      <input type="hidden" name="passportPic" value="${aviationUserInfo.passportPic}">

      <div class="modal-body">

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">姓氏（拼音）：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control" name="firstName" value="${aviationUserInfo.firstName}" data-validate="required"/>
          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">名字（拼音）：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control" name="lastName" value="${aviationUserInfo.lastName}" data-validate="required"/>
          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">生日：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control datetimepicker birthday" autocomplete="off" name="birthday" value="<fmt:formatDate value="${aviationUserInfo.birthday}" pattern="yyyy-MM-dd"></fmt:formatDate>" data-validate="required"/>
          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">护照号：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control" name="passportCode" value="${aviationUserInfo.passportCode}" data-validate="required"/>
          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">护照到期时间：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control datetimepicker" autocomplete="off" name="passportExpirationTime" value="<fmt:formatDate value="${aviationUserInfo.passportExpirationTime}" pattern="yyyy-MM-dd"></fmt:formatDate>" data-validate="required"/>

          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">护照签发国：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control" name="passportIssuingCountry" value="${aviationUserInfo.passportIssuingCountry}" data-validate="required"/>
          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">性别：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <select class="form-control select2" name="gender" data-validate="required">
              <option value="男" ${aviationUserInfo.gender == '男' ? 'selected' : ''}>男</option>
              <option value="女" ${aviationUserInfo.gender == '女' ? 'selected' : ''}>女</option>
            </select>
          </div>
        </div>

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">国籍：</label>
          <div class="col-xs-8 pull-left role-login-name">
            <input type="text" class="form-control" name="nationality" value="${aviationUserInfo.nationality}" data-validate="required"/>
          </div>
        </div>


      </div>

      <div class="modal-footer ms-modal-footer">
        <button type="submit" class="btn ms-btn btn-primary">确定</button>
        <button type="button" class="btn ms-btn ms-btn-gary" data-dismiss="modal">取消</button>
      </div>
    </form>

  </div>
</div>
<script>

  $("#reverse-order-edit-aviatino-user-info-dialog").find('form[data-validate="true"]').bt_validate()  //bind validate

  var $form = $("#reverse-order-edit-aviatino-user-info-dialog").find("form")                          //bind shiftform

  $form.shiftform({
    beforeSubmit: function (el) {
      $form.trigger("validate.ajax.submit");
      return $.bt_validate.result[$.bt_validate.form_id]
    }
  })

  $('.datetimepicker').datetimepicker({
    format: 'yyyy-mm-dd',
    autoclose: true,
    language: 'zh-CN',
    todayBtn: 'linked',
    startDate: '${today}',
    todayHighlight: true,
    pickerPosition: 'bottom-right',
    minView: 'month'
  });

  $('.select2').select2({
    placeholder: '请选择',
    minimumResultsForSearch: -1,
    allowClear: true,
  });


</script>
